package de.revdev.streckenliste.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author f.lindermaier
 */
@Entity
@Table(name = "tbl_Wildtyp")
public class Wildtyp implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "idWildtyp")
    private Long id;
    @Size(min = 1, max = 40)
    private String nameWT;
    @NotNull
    private boolean abschPlPfl;
    private int dauerAbschPL;
    private int sort;
    @OneToMany(mappedBy = "wildtyp", cascade = CascadeType.ALL)
    private List<Wildart> wildart;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNameWT() {
        return nameWT;
    }

    public void setNameWT(String nameWT) {
        this.nameWT = nameWT;
    }

    public List<Wildart> getWildart() {
        return wildart;
    }

    public void setWildart(List<Wildart> wildart) {
        this.wildart = wildart;
    }

    public boolean isAbschPlPfl() {
        return abschPlPfl;
    }

    public void setAbschPlPfl(boolean abschPlPfl) {
        this.abschPlPfl = abschPlPfl;
    }

    public int getDauerAbschPL() {
        return dauerAbschPL;
    }

    public void setDauerAbschPL(int dauerAbschPL) {
        this.dauerAbschPL = dauerAbschPL;
    }

    public int getSort() {
        return sort;
    }

    public void setSort(int sort) {
        this.sort = sort;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Wildtyp)) {
            return false;
        }
        Wildtyp other = (Wildtyp) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "de.revdev.streckenliste.entities.Wildtyp[ id=" + id + " ]";
    }
}
